# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        Young  
# Name:         demo1061
# Description:
# Author:       $赵怡蕾
# Date:         2019/3/27
#-------------------------------------------------------------------------------

nestedList = [[1,2,3],[4,3,2],[1,2,4,5,7]]

# 双重循环
def enumList(nestedList):
    for subList in nestedList:
        for element in subList:
            yield element


# import time
# 对生成器函数进行迭代
for num in enumList(nestedList):
    print(num,end=' ')
    # time.sleep(1)    # 延迟1秒一个一个生成

print()
# 将生成器函数转换成列表
numList = list(enumList(nestedList))
print(numList)
print(numList[1:5])